package com.syx.migration.web;

import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.syx.migration.service.IBasicInfoModuleService;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/migrate/basic")
public class BasicInfoModuleController {

    private final IBasicInfoModuleService basicInfoService;

    @DSTransactional
    @GetMapping("/all")
    public void all(){
//        basicInfoService.migrateSchool();
        basicInfoService.migrateBlurb();
        basicInfoService.migrateNotice();
        basicInfoService.migrateRegime();
        basicInfoService.migratePreviewRoom();
        basicInfoService.migrateLibraryRoom();
        basicInfoService.migrateLibraryBookself();
    }

    /**
     * 学校
     */
    @GetMapping("/school")
    public void migrateSchool(){
        basicInfoService.migrateSchool();
    }

    /**
     * 简介/公告/规章制度
     */
    @GetMapping("/blurb")
    public void migrateBlurb(){
        basicInfoService.migrateBlurb();
        basicInfoService.migrateNotice();
        basicInfoService.migrateRegime();
    }

    /**
     * 预览室
     */
    @GetMapping("/previewRoom")
    public void previewRoom(){
        //预览室sfb_reading_room
        basicInfoService.migratePreviewRoom();
    }

    /**
     *藏书室
     */
    @GetMapping("/libraryRoom")
    public void libraryRoom(){
        //藏书室syx_library_room
        basicInfoService.migrateLibraryRoom();
    }


    /**
     *藏书室
     */
    @GetMapping("/libraryBookself")
    public void libraryBookself(){
        //藏书室syx_library_bookself
        basicInfoService.migrateLibraryBookself();
    }

}
